/**
 * 
 */
package fr.aprr.odyssee.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author PHAM
 *
 */
public class HeaderMenu extends Composite{

	private static HeaderMenuUiBinder uiBinder = GWT
			.create(HeaderMenuUiBinder.class);

	interface HeaderMenuUiBinder extends UiBinder<Widget, HeaderMenu> {
	}

	/**
	 * Because this class has a default constructor, it can
	 * be used as a binder template. In other words, it can be used in other
	 * *.ui.xml files as follows:
	 * <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
	 *   xmlns:g="urn:import:**user's package**">
	 *  <g:**UserClassName**>Hello!</g:**UserClassName>
	 * </ui:UiBinder>
	 * Note that depending on the widget that is used, it may be necessary to
	 * implement HasHTML instead of HasText.
	 */

	@UiField(provided = true) 
	MenuBar mainMenu;
	
	public HeaderMenu() {
		// File Menu
		MenuBar filemenu = new MenuBar(true);
		filemenu.setAnimationEnabled(true);
		filemenu.addItem("Version", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Version");
			}
		});
		
		filemenu.addItem("Quitter", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Quitter");
			}
		});
		
		// Configuation Menu
		MenuBar configmenu = new MenuBar(true);
		configmenu.setAnimationEnabled(true);
		configmenu.addItem("Configuration de l'application", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Configuration de l'application");
			}
		});
		
		configmenu.addItem("Configuration barre de passage", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Configuration barre de passage");
			}
		});
		
		// Affichage Menu
		
		MenuBar affimenu = new MenuBar(true);
		affimenu.setAnimationEnabled(true);
		affimenu.addItem("Dijon", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Dijon");
			}
		});
		
		affimenu.addItem("Paris", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Paris");
			}
		});
		
		// Archive Menu
		MenuBar archivemenu = new MenuBar(true);
		archivemenu.setAnimationEnabled(true);
		archivemenu.addItem("Change archive", new Command() {
			
			@Override
			public void execute() {
				// TODO Auto-generated method stub
				Window.alert("Change archive");
			}
		});
		
		
		// Main menu
		mainMenu = new MenuBar();
		mainMenu.setAutoOpen(true);
		mainMenu.setWidth("100%");
		mainMenu.setAnimationEnabled(true);
		mainMenu.addItem("Info", filemenu);
		mainMenu.addItem("Configuation", configmenu);
		mainMenu.addItem("Affichage", affimenu);
		mainMenu.addItem("Archive", archivemenu);
		
		initWidget(uiBinder.createAndBindUi(this));
	}

	public HeaderMenu(String firstName) {
		initWidget(uiBinder.createAndBindUi(this));

	}
	
	
    
}
